package jmine.tec.rpc;

import bancosys.tec.exception.LocalizedMessageHolder;
import bancosys.tec.exception.MessageCreator;
import bancosys.tec.exception.MessageCreatorHelper;

/**
 * @author lundberg
 */
public enum RPCMessages implements MessageCreator {
    JSON_PARSE_EXCEPTION(0, "jmine.tec.json.parse.exception"),

    CLASS_NOT_FOUND(1, "jmine.tec.rpc.class.not.found"),

    JSON_ERROR_CREATING_BEAN(0, "jmine.tec.json.error.creating.bean"),

    IMPLEMENTOR_DOES_NOT_IMPLEMENT_GIVEN_SERVICE(2, "jmine.tec.rpc.implementor.does.not.implement.given.service"),

    COMMUNICATION_ERROR(1, "jmine.tec.rpc.communication.error"),

    REMOTE_SERVICE_UNAVAILABLE(1, "jmine.tec.rpc.remote.service.unavailable"),

    NO_DESERIALIZATION_STRATEGY_FOUND(1, "jmine.tec.rpc.no.deserialization.strategy.found"),

    SERVICE_NOT_FOUND(1, "jmine.tec.rpc.service.not.found"),

    JSON_IO_EXCEPTION_SERIALIZING_OBJECT(0, "jmine.tec.json.io.exception.serializing.object"),

    SERVICE_MUST_BE_AN_INTERFACE(1, "jmine.tec.rpc.service.must.be.an.interface"),

    SERIALIZATION_JSON_ERROR_READING_PROPERTY(3, "jmine.tec.rpc.serialization.json.error.reading.property"),

    INVALID_DATE_VALUE(1, "jmine.tec.rpc.invalid.date.value"),

    REMOTE_EXCEPTION_MESSAGE(1, "jmine.tec.rpc.remote.exception.message"),

    UNEXPECTED_ERROR(1, "jmine.tec.rpc.unexpected.error"),

    NO_SERIALIZATION_STRATEGY_FOUND(1, "jmine.tec.rpc.no.serialization.strategy.found"),

    STALE_REPRESENTATION(1, "jmine.tec.rpc.stale.representation"),

    JSON_IO_EXCEPTION_DESERIALIZING_OBJECT(0, "jmine.tec.json.io.exception.deserializing.object"),

    REFLECTION_REPRESENTATION_FAILED(3, "jmine.tec.rpc.reflection.representation.failed"),

    IMPLEMENTOR_DOES_NOT_IMPLEMENT_ANY_SERVICE(1, "jmine.tec.rpc.implementor.does.not.implement.any.service"),

    ENTITY_REST_SERVICE_NOT_FOUND(1, "jmine.tec.rpc.entity.rest.service.not.found"),

    NULL_SERVICE_CLASS(0, "jmine.tec.rpc.null.service.class"),

    REFERENCE_FOUND_BEFORE_OBJECT(1, "jmine.tec.rpc.reference.found.before.object"),

    NO_PROPERTY_REPRESENTER_FOUND(1, "jmine.tec.rpc.no.property.representer.found"),

    SERVICE_ANNOTATION_NOT_FOUND(1, "jmine.tec.rpc.service.annotation.not.found");

    private final MessageCreator delegate;

    /**
     * Construtor
     * 
     * @param nargs nargs
     * @param key key
     */
    private RPCMessages(int nargs, String key) {
        this.delegate = MessageCreatorHelper.creator("jmine-tec-rpc-messages", key, nargs);
    }

    /**
     * {@inheritDoc}
     */
    public LocalizedMessageHolder create(Object... arguments) {
        return this.delegate.create(arguments);
    }

    /**
     * {@inheritDoc}
     */
    public int getExpectedArguments() {
        return this.delegate.getExpectedArguments();
    }
}
